package com.yunc.common.disruptor;

import com.lmax.disruptor.EventHandler;

public abstract class AbstractEventHandler<T> implements EventHandler<Event<T>> {

    @Override
    public void onEvent(Event<T> tEvent, long l, boolean b) {
        if (filter(tEvent)) {
            T t = tEvent.getValue();
            handler(t);
        }
    }

    public boolean filter(Event<T> event) {
        return false;
    }

    public abstract void handler(T t);
}


